

/*

	JS2.js
	version 4.5.1
	MIT / (More accurately - X11 License)
	First Created: 10/27/2000
	Last Revised: 07/29/2008
	Zimsical.com
	http://code.google.com/p/js2/
	wordup@zimsical.com

*/


// -------- BEGIN BROWSER DETECTION, DEBUG AND VERSIONING -----------


JS2 = {
	Version : "4.5.1",
	Debug : 1,
	Browser : {
		IE:     !!(window.attachEvent && !window.opera),
		Opera:  !!window.opera,
		WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
		Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
    	MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
	},
	size : function () {
		return this.length;
	},
	init : function () {
		if (this.Debug) {
			alert("Debug Activated!");
		}
	}
}


// -------- END BROWSER DETECTION, DEBUG AND VERSIONING -----------


// -------- EVENT MANAGEMENT ----------


Events = {
	AddEvent : function (elem, evtType, func, capture) {
		capture = (capture) ? capture : false;
		if (elem.addEventListener) {
			elem.addEventListener(evtType, func, capture);
		} else if (elem.attachEvent) {
			elem.attachEvent("on" + evtType, func);
		} else {
			elem["on" + evtType] = func;
		}
	},
	RemoveEvent : function (elem, evtType, func, capture) {
		capture = (capture) ? capture : false;
		if (elem.removeEventListener) {
			elem.removeEventListener(evtType, func, capture);
		} else if (elem.attachEvent) {
			elem.detatchEvent("on", evtType, func);
		} else {
			elem["on" + evtType] = null;
		}
	},
	AddOnLoadEvent : function (func) {
		if (window.addEventListener || window.attachEvent) {
			this.AddEvent(window, "load", func, false);
		}
	},
	BlockEvents : function (evt) {
		evt = (evt) ? evt : event;
		var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		if (elem && elem.tagName && elem.tagName.toLowerCase() == "img") {
			if (evt.cancelBubble) {
				evt.cancelBubble = true;
			}
			alert("Event Bubble Cancel Unavailable!");
			return false;
		}
	},
	DisableContextMenu : function () {
		document.oncontextmenu = this.BlockEvents;
	}
}


Events.AddOnLoadEvent(JS2.init);


// -------- END BROADCAST, EVENT AND LISTENER FUNCTIONS ----------


// -------- BEGIN OBJECT REFERENCING -----------


function $() {
	var Elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var Element = arguments[i];
		if (typeof Element == 'string')
			Element = document.getElementById(Element);
		if (arguments.length == 1) {
			return Element;
			Elements.push(element);
		}
	}
	return Elements;
}


function $s(x) {
	return $(x).style;
}


// -------- END OBJECT REFERENCING -----------


// -------- BEGIN STRING, INT AND ARRAY  -----------


Variables = {
	DECtoHEX : function (dec) {
		return (dec < 16 ? "0" : "") + dec.toString(16);
	},
	ExtractNumber : function (value) {
		var n = parseInt(value);
		return n == null || isNaN(n) ? 0 : n;
	},
	SplitSemi : function (x) {
		y = x.split(";");
		return y;	
	},
	Printr : function (arr) {
		for (var i = 0; i < arr.length; i++) {
			document.write(arr[i] + "<br />");
		}
	},
	STRtoARR : function (str) {
		var arr = str.split(",");
		return arr;
	},
	HEXtoDECIMEL : function (hex) {
		return(Variables.ParseInt(hex, 16));
	}
}


Array.prototype.RemoveByValue = function (value) {
	for (var i = this.length; i >= 0; i--) {
		if (this[i] == value) {
			this.splice(i, 1); 
			return value; 
		}
	}
}


// -------- END STRING, INT AND ARRAY  -----------


// -------- BEGIN DATE  -----------


Clock = {
	now : function () {
		return new Date;
	}
}


// -------- END DATE  -----------


// -------- BEGIN getElementsByClassName non-native (as of yet) ----------


document.GetElementsByClassName = function (MyClass) {
	var ReturnNode = [];
	var MyClass = new RegExp('\\b'+MyClass+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var TheClass = elem[i].ClassName;
		if (MyClass.test(TheClass)) {
			ReturnNode.push(elem[i]);
		}
	}
	return ReturnNode;
};


// -------- END getElementsByClassName non-native (as of yet) ----------


// -------- BEGIN SimpleToolTips CLASS ----------


SimpleToolTips = {
	startX: 0,
	startY: 0,
	offsetX: 0,
	offsetY: 0,
	hoverOverElement: "",
	oldZIndex: 0,
	tip: "",
	tipText: "No Text Defined!",
	init : function () {
		toolTipAnchors = document.GetElementsByClassName("tooltip"); 
			for (x = 0; x < toolTipAnchors.length; x++) {
				tipText = toolTipAnchors[x].title;
				Events.AddEvent(toolTipAnchors[x], "mouseover", SimpleToolTips.OnMouseOver, false);
				Events.AddEvent(toolTipAnchors[x], "mouseout", SimpleToolTips.OnMouseOut, false);
			}
	},
	CreateTip : function (str) {
		tip = document.createElement("DIV"); 
		document.body.appendChild(tip); 
		tip.setAttribute('id','myToolTip');
		with(tip.style) {
			position = 'absolute';
			background = "#f3f3f3";
			top = this.startX;
			left = this.startY;
			display = "none";
			padding = "10px";
			font = "13px Myriad, Tahoma, Lucida, Helvetica, Arial, sans-serif";
			color = "#5a5a5a";
			border = "1px solid #b3b3b3";
		}
		tip.innerHTML = "<p>" + str + "</p>";
		Animation.ChangeOpacity("myToolTip", 0);
		Animation.Toggle("myToolTip");
		Animation.Opacity("myToolTip", 0, 100, 400);
	},
	OnMouseOver : function (e) {
		if (e == null) e = window.event; 
		// IE: srcElement | Other Browsers: target
		var target = e.target != null ? e.target : e.srcElement;
		tipText = target.title;
		this.CreateTip(tipText);
		// IE, left click == 1
		// Firefox, left click == 0
		if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'tooltip') {
			// Current Mouse Position
			startX = e.clientX - 100;
			startY = e.clientY - 50;
			// Grab the Clicked Element's Position
			offsetX = ExtractNumber(target.style.left);
			offsetY = ExtractNumber(target.style.top);
			// Bring Draggable to Front while being Dragged
			oldZIndex = target.style.zIndex;
			target.style.zIndex = 100;
			// Item to Drag
			hoverOverElement = target;
			// Mouse Moves, Object Moves
			Events.AddEvent(document, "mousemove", SimpleToolTips.OnMouseMove, false);
			// No Text Selection
			document.body.focus();
			document.onselectstart = function () {
				return false;
			};
			return false;
		}
	},
	OnMouseMove: function (e) {
		if (e == null) var e = window.event; 
		tip.style.left = (offsetX + e.clientX - startX) + 'px';
		tip.style.top = (offsetY + e.clientY - startY) + 'px';
	},
	OnMouseOut: function (e) {
		if (tip != null) {
			// Return old z-Index
			tip.style.zIndex = oldZIndex;
			// Cancel Dragging
			document.onmousemove = null;
			document.onselectstart = null;	
			Animation.Opacity("myToolTip", 100, 0, 400);
			Animation.Toggle("myToolTip");
			tip = null;
		}
	}

}


Events.AddOnLoadEvent(SimpleToolTips.init);


// -------- END SimpleToolTips CLASS ----------


// -------- BEGIN DragAndDrop CLASS ----------


DragAndDrop = {
	startX: 0,
	startY: 0,
	offsetX: 0,
	offsetY: 0,
	DragElement: null,
	oldZIndex: 0,
	PositionCSS : function () {
		CSS.InsertCSS(".drag { position: relative }");
	},
	OnMouseDown : function (e) {
		if (e == null) e = window.event; 
		var target = e.target != null ? e.target : e.srcElement;
		if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'drag') {
			startX = e.clientX;
			startY = e.clientY;
			offsetX = Variables.ExtractNumber(target.style.left);
			offsetY = Variables.ExtractNumber(target.style.top);
			oldZIndex = target.style.zIndex;
			target.style.zIndex = 100;
			DragElement = target;
			document.onmousemove = DragAndDrop.OnMouseMove;
			document.body.focus();
			document.onselectstart = function () {
				return false;
			};
			return false;
		}
	},
	OnMouseMove : function (e) {
		if (e == null) var e = window.event; 
		DragElement.style.left = (offsetX + e.clientX - startX) + 'px';
		DragElement.style.top = (offsetY + e.clientY - startY) + 'px';
	},
	OnMouseUp : function (e) {
		if (DragElement != null && DragElement != undefined) {
			DragElement.style.zIndex = oldZIndex;
			document.onmousemove = null;
			document.onselectstart = null;	
			DragElement = null;
		}
	},
	init : function () {
		Events.AddEvent(document, "mousedown", DragAndDrop.OnMouseDown, false);
		Events.AddEvent(document, "mouseup", DragAndDrop.OnMouseUp, false);
		DragAndDrop.PositionCSS();
	}
}


// -------- END DragAndDrop ----------


// -------- BEGIN CSS -----------


CSS = {
	InsertCSS : function (css) {
		var ss = document.createElement("style");
		ss.type = "text/css";
		var sst = document.createTextNode(css);
		ss.appendChild(sst);
		document.getElementsByTagName("head")[0].appendChild(ss);
	},
	DisableFirstStyleSheet : function () {
		document.getElementsByTagName('link')[0].disabled = true;
	},
    SetVisibility: function(Element) {
        $(Element).visibility = "visible";
    }
}


// -------- END CSS -----------


// -------- BEGIN JSON -----------


JSON = {
    SerializeJSON: function(JSONString) {
    },
    LoadJSON: function(URL) {
    }

}


// -------- END JSON -----------


// -------- BEGIN DIMENSIONS -----------


Dimensions = {
    GetMousePosition : function (e) {
        var PosX = 0;
        var PosY = 0;
        if (!e) { 
        	var e = window.event;
        }
        if (e.pageX || e.pageY) {
            PosX = e.pageX;
            PosY = e.pageY;
        }
        else if (e.clientX || e.clientY) {
            PosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            PosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
        }
        return {x: PosX, y: PosY};
    },
    GetScrollTop : function () {
        var T;
        if (document.documentElement && document.documentElement.scrollTop) {
			T = document.documentElement.scrollTop;
		}
        else if (document.body) {
                T = document.body.scrollTop;
		}
        return T;
    },
    GetAbsolutePosition : function (Element) {
        if (Element.scrollLeft) {
            return {x: Element.scrollLeft, y: Element.scrollTop};
		}
        else if (Element.clientX) {
			return {x: Element.clientX, y: Element.clientY};
		}
		var PosObject = {'x': Element.offsetLeft, 'y': Element.offsetTop};
        if (Element.offsetParent) {
            var Next = Element.offsetParent;
            while (Next) {
                PosObject.x += Next.offsetLeft;
                PosObject.y += Next.offsetTop;
                Next = Next.offsetParent;
            }
        }
        if ((JS2.Browser.WebKit || JS2.Browser.MobileSafari) && Element.style.position == 'absolute' ) {
            PosObject.x -= document.body.offsetLeft;
            PosObject.y -= document.body.offsetTop;
        }
        return PosObject;
    },
    GetWindowSize : function(doc) {
        doc = doc || document;
        var win_w, win_h;
        if (self.innerHeight) {
            win_w = self.innerWidth;
            win_h = self.innerHeight;
        } else if (doc.documentElement && doc.documentElement.clientHeight) {
            win_w = doc.documentElement.clientWidth;
            win_h = doc.documentElement.clientHeight;
        } else if (doc.body) {
            win_w = doc.body.clientWidth;
            win_h = doc.body.clientHeight;
        }
        return {'w': win_w, 'h': win_h};
    },
	IsOverlapping : function(Element1, Element2) {
        var PositionElement1 = AJS.absolutePosition(Element1);
        var PositionElement2 = AJS.absolutePosition(Element2);
        var top1 = PositionElement1.y;
        var left1 = PositionElement1.x;
        var right1 = left1 + Element1.offsetWidth;
        var bottom1 = top1 + Element1.offsetHeight;
        var top2 = PositionElement2.y;
        var left2 = PositionElement2.x;
        var right2 = left2 + Element2.offsetWidth;
        var bottom2 = top2 + Element2.offsetHeight;
        var getSign = function(v) {
            if(v > 0) return "+";
            else if(v < 0) return "-";
            else return 0;
        }
        if ((getSign(top1 - bottom2) != getSign(bottom1 - top2)) && (getSign(left1 - right2) != getSign(right1 - left2))) {
			return true;
		}
        return false;
    }
}


// -------- END DIMENSIONS -----------


// -------- BEGIN MISCELLANEOUS  -----------


Misc = {
	Pause : function (numberMillis) {
		var now = new Date();
		var exitTime = now.getTime() + numberMillis;
		while (true) {
			now = new Date();
			if (now.getTime() > exitTime)
			return;
		}
	},
	ChangeStatusBar : function (str) {
		window.status = str;
	},
	GenerateRandomNumber : function (StartInteger, FinishInteger) {
		var RandomNumber = Math.floor(Math.random() * (FinishInteger - StartInteger + 1)) + StartInteger;
		return RandomNumber;
	}
}


// -------- BEGIN DOM/XML MANIPULATION -----------


DOM = {
	InsertAfter : function (parent, node, referenceNode) {
		parent.insertBefore(node, referenceNode.nextSibling);
		return node;
	},
    InsertBefore: function (parent, node, referenceNode) {
        parentNode.insertBefore(node, referenceNode);
        return node;
    }
}


// -------- END DOM/XML MANIPULATION -----------


// -------- BEGIN IMAGE PRELOADING AND ROLLOVER  -----------


// Preload Images
RolloverImages = {
	height: 20,
	width: 50,
	sharedImgURIs : ["img/home", "img/prod", "img/support", "img/contact"],
	normalSuffix: "Normal.png",
	hiliteSuffix: "Hilite.png",
	preloadImages: function () {
		var imgObj = new Image(this.height, this.width);
		for (i = 0; i < this.sharedImgURIs; i++) {
			imgObj.src = this.sharedImgURIs[i] + this.normalSuffix;
			imgObj.src = this.sharedImgURIs[i] + this.hiliteSuffix;
		}
	},
	ToggleImage : function (evt) {
		evt = (evt) ? evt : event;
		var elem = (evt.target) ? evt.target : evt.srcElement;
		if (elem && elem.src) {
			var reOff = new RegExp("(.*)(" + this.normalSuffix + ")");
			var reOn = new RegExp("(.*)(" + this.hiliteSuffix + ")");
			if (reOff.test(elem.src)) {
				elem.src = reOff.exec(elem.src)[1] + this.hiliteSuffix;
			} else {
				elem.src = reOn.exec(elem.src)[1] + this.normalSuffix;		
			}
		}
	},
	SetRollovers : function () {
		Events.AddEvent(document.getElementById("home"), "mouseover", function (evt) { this.ToggleImage(evt) }, false);
		Events.AddEvent(document.getElementById("home"), "mouseout", function (evt) { this.ToggleImage(evt) }, false);
	}
}


// -------- BEGIN FORM  -----------


Forms = {
	FormFalse : function () {
		return false;
	},
	FocusFormElement : function (ID) {
		$(ID).focus();
	},
	CheckAddition : function (Sum1, Sum2, AttemptedValue) {
		val = document.forms[0].addition.value;
		if (Sum1 + Sum2 == AttemptedValue) {
			return true;
		} else {
			alert("To keep out spammers, answer the following question: What is " + Sum1 + " + " + Sum2 + " ?");
			return false;
		}
	},
	IsEmail : function (formElement) {
		var str = formElement.value;
		var RegExp = /^[\W-]+(\.[w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
		if (str.match(RegExp)) {
			return true;
		} else {
			return false;
		}	
	},
	ValidateRequiredWhiteSmoke : function (field, alerttxt) {
		with (field) {
			if (value == null || value == "") {
				alert(alerttxt);
				return false;
			} else {
 				return true;
			}
		}
	},
	CheckForm : function (aForm, NewElementColor) {
		formLength = aForm.elements.length;
		formErrors = 0;
		formErrorNames = "Missing Fields: ";
		for (i = 0; i < formLength; i++) {
			formElementType = aForm.elements[i].type;
			formElementValue = aForm.elements[i].value;
			formElementName = aForm.elements[i].name;
			formElementID = aForm.elements[i].id;
			if (formElementType == "text" || formElementType == "password") {
				if (formElementValue == "" || formElementValue == null) {
					aForm.elements[i].style.backgroundColor = NewElementColor;
					if (formElementName != "") {
						formErrors += 1;
						formErrorNames += formElementID + ", ";
					}
				}
			}
			if (formElementType == "select-one" || formElementType == "select-multiple" || formElementType == "textarea") {
				if (formElementValue == "") {
					aForm.elements[i].style.backgroundColor = NewElementColor;
					formErrors += 1;
					formErrorNames += formElementID + ", ";
				}
			}
			if (formElementType == "checkbox") {
				if (aForm.elements[i].checked == true) {
					checked = true;
				} else {
					checked = false;
				}
			}
		}
		var strLen = formErrorNames.length;
		formErrorNames2 = formErrorNames.slice(0,strLen-2);
  		if (formErrors > 0) {
  			errorStr = "You have left (" + formErrors + ") fields empty";
  	    	alert(errorStr);
  	   		alert(formErrorNames2);
    		return false;
  		} else {
  			if (confirm('Please review your information and click Cancel to go back to edit or click OK to submit')) {
  				return true;
  			} else {
  				return false;
  			}
		}
	}
}


// -------- END FORM  -----------


// -------- BEGIN AJAX -----------


AJAX = {
	MaximumExecutionTime : 15,
	MinimumTimeBetweenRequests : 5,
	GetParams : function (aForm) {
		aForm = document.forms[aForm];
		formLength = aForm.elements.length;
		Params = "";
		if (formLength > 0) {
			for (i = 0; i < formLength; i++) {
				formElementType = aForm.elements[i].type;
				formElementValue = aForm.elements[i].value;
				formElementName = aForm.elements[i].name;
				formElementID = aForm.elements[i].id;
				if (formElementType == "text" || formElementType == "password" || formElementType == "textarea" || formElementType == "select-one" || formElementType == "hidden") {
					if (i == 0) {
						Sym = "?";
					} else {
						Sym = "&";
					}
					Params += Sym + formElementName + "=" + formElementValue;
				}
			}
			return Params;
		} else {
			return "";
		}
	},
	GetXMLHTTP : function () {
		var XMLHTTP = false;
		if (window.XMLHttpRequest) {
			XMLHTTP = new XMLHttpRequest()
  		} else if (window.ActiveXObject) {
			try {
				XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP")
			} catch (e) { 
				try {
        			XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
      			} catch (E) {
        			XMLHTTP = false;
      			}
      		}
    	}
	return XMLHTTP;
	},
	AJAXToFunction : function (URL, aForm) {
		var XMLHTTP = new GetXMLHTTP();
		// Compatibility with IE 5.0
		// Send the Request
		Params = this.GetParams(aForm);
		if (XMLHTTP) {
			XMLHTTP.onreadystatechange = function stateChange() {
				if (XMLHTTP && XMLHTTP.readyState == 4) {
					// Got something back..
					if (XMLHTTP.status == 200) {
						// Check to see if the response was good
						var response = XMLHTTP.responseText;
						if(JS2.debug) {
							alert(response);
						}
						eval(response);
					} else if(JS2.debug){
						document.write(XMLHTTP.responseText);
					}
				}
			}
			// open the page
			XMLHTTP.open("GET", URL+Params, true);
			// send the data
			XMLHTTP.send(null);
		}
	},
	AJAX : function (URL) {
		var XMLHTTP = new GetXMLHTTP();
		// Compatibility with IE 5.0
		// Send the Request
		if (XMLHTTP) {
			XMLHTTP.onreadystatechange = function stateChange() {
				if (XMLHTTP && XMLHTTP.readyState == 4) {
					// Got something back..
					if (XMLHTTP.status == 200) {
						// Check to see if the response was good
						var response = XMLHTTP.responseText;
						if(JS2.debug) {
							alert(response);
						}
						eval(response);
					} else if(JS2.debug){
						document.write(XMLHTTP.responseText);
					}
				}
			}
			// open the page
			XMLHTTP.open("GET", URL, true);
			// send the data
			XMLHTTP.send(null);
		}
	},
	InnerFromAJAX : function (URL, obj_id, aForm, execAfterEval) {
		var XMLHTTP = new AJAX.GetXMLHTTP();
		Params = this.GetParams(aForm);
		// Send the Request
		if (XMLHTTP) {
			XMLHTTP.onreadystatechange = function stateChange() {
				if (XMLHTTP && XMLHTTP.readyState == 4) {
					// Got something back..
					if (XMLHTTP.status == 200) {
						// Check to see if the response was good
						var response = XMLHTTP.responseText;
						if(JS2.debug) {
							alert(response);
						}
						document.getElementById(obj_id).innerHTML = response;
						if(JS2.debug) {
							alert(execAfterEval);
						}
						eval(execAfterEval);
					} else if(JS2.debug){
						document.write(XMLHTTP.responseText);
					}
				}
			}
		// open the page
		XMLHTTP.open("GET", URL+Params, true);
		// send the data
		XMLHTTP.send(null);
		}
	},
	InstantAJAX : function (instantFile, instantDIV, instantIndicator, instantForm, execAfterEval) {
		document.getElementById(instantIndicator).style.display = "block";
		document.getElementById(instantDIV).style.display = "block";
		var XMLHTTP = new GetXMLHTTP();
		// Compatibility with IE 5.0
		Params = this.GetParams(instantForm);
		// Send the Request
		if (XMLHTTP) {
			XMLHTTP.onreadystatechange = function stateChange() {
				if (XMLHTTP && XMLHTTP.readyState == 4) {
					// Got something back..
					if (XMLHTTP.status == 200) {
						// Check to see if the response was good
						var response = XMLHTTP.responseText;
						if(JS2.debug) {
							alert(response);
						}
						document.getElementById(instantDIV).innerHTML = response;
						if(JS2.debug) {
							alert(execAfterEval);
						}
						eval(execAfterEval);
						$s(instantIndicator).display = "none";
					} else if(JS2.debug){
						document.write(XMLHTTP.responseText);
					}
				}
			}
		// open the page
		XMLHTTP.open("GET", instantFile + Params, true);
		// send the data
		XMLHTTP.send(null);
		}
	}
}


// -------- END AJAX -----------


// -------- BEGIN MODAL WINDOWS -----------


ModalWindows = {
	ModalWindow : function (ModalID, HolderID) {
		Animation.ChangeOpacity(ModalID, 0);
		$s(modalID).display = 'block';
		Animation.Opacity(HolderID, 100, 40, 200);
		Animation.Opacity(ModalID, 0, 100, 300); 
	},
	CloseModal : function (ModalID, HolderID) {
		Animation.Opacity(ModalID, 100, 0, 300);
		Animation.Opacity(HolderID, 40, 100, 300);
		$s(ModalID).display = 'none';
	},
	CloseIndicator : function (IndicatorID) {
		Animation.Opacity(IndicatorID, 100, 0, 300);
		$s(IndicatorID).display = 'none';
	},
	OpenIndicator : function (IndicatorID) {
		Animation.ChangeOpacity(IndicatorID, 0);
		$s(IndicatorID).display = 'block';
		Animation.Opacity(IndicatorID, 0, 100, 300);
	}
}


// -------- END MODAL WINDOWS -----------


// -------- BEGIN COOKIES -----------


Cookies = {
	GetExpDate : function (days, hours, minutes) {
		var expDate = new Date();
		if (typeof(days) == "number" && typeof(hours) == "number" && typeof(minutes) == "number") {
			expDate.setDate(expDate.getDate() + parseInt(days));
			expDate.setHours(expDate.getHours() + parseInt(hours));
			expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
			return expDate.toUTCString();
		}
	},
	GetCookieVal : function (offset) {
		var endstr = document.cookie.indexOf(";", offset);
		if (endstr == -1) {
			endstr = document.cookie.length;
		}
		return decodeURI(document.cookie.substring(offset, endstr));
	},
	GetCookie : function (name) {
		var arg = name + "=";
		var alen  = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen) {
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg) {
				return getCookieVal(j);
			}
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
		return "";
	},
	SetCookie : function (name, expires, path, domain, secure) {
		document.cookie = name + "=" + encodeURI(value) +
			((expires) ? "; expires=" + expires : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure=" + secure : "");
	},
	DeleteCookie : function (name, path, domain) {
		if(this.GetCookie(name)) {
			document.cookie = name + "=" +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
		}
	}
}


// -------- END COOKIES -----------


// -------- BEGIN THREADS (Made Possible by AJAX/Asynchronous) -----------


Threads = {
	MAX_THREADS : 500,
	CurrentWorkingThreadCount: 0,
	CurrentThread: 0,
	init : function () {
	}
}


Events.AddOnLoadEvent(Threads.init);


// -------- END THREADS -----------


// -------- BEGIN ANIMATION -----------


Animation = {
	Interval : 20,
	Duration : 400,
	Timer    : 0,
	State    : 0,
	OnComplete: function () {},
	OnStep: function () {},
	Transition: this.EaseInOut,
	MakeEaseIn : function (a, state) {
		return Math.pow(state, a*2); 
	},
	MakeEaseOut : function (a, state) {
		return 1 - Math.pow(1 - state, a*2); 
	},
	MakeElastic : function (bounces, state) {
		return ((1-Math.cos(state * Math.PI * bounces)) * (1 - state)) + state; 
	},
	EaseInOut: function (pos) {
		return ((-Math.cos(pos*Math.PI)/2) + 0.5); 
	},
	Linear : function (x) {
		return x;
	},
	Fader : function (id, OpacityStart, OpacityEnd, millisec) {
		var speed = Math.round(millisec / 100);
		var timer = 0;
		if (OpacityStart > OpacityEnd) {
			for (i = OpacityStart; i >= OpacityEnd; i--) {
				setTimeout("Animation.ChangeOpacity('" + id + "'," + i + ")", (timer * speed));
				timer++;
			}
		} else if (OpacityStart < OpacityEnd) {
			for (i = OpacityStart; i <= OpacityEnd; i++) {
				setTimeout("Animation.ChangeOpacity('" + id + "'," + i + ")", (timer * speed));
				timer++;
			}
		}
	},
	ToggleVisibility : function (obj) {
		var el = $(obj);
		if ( el.style.display != 'none' ) {
			el.style.display = 'none';
		}
		else {
			el.style.display = '';
		}
	},
	ChangeOpacity : function (ID, Opacity) {
		var Object = $(ID).style;
		Object.opacity = (Opacity / 100);
		Object.MozOpacity = (Opacity / 100);
		Object.KhtmlOpacity = (Opacity / 100);
		Object.filter = "alpha(opacity=" + Opacity + ")";
	},
	JumpTo : function (to) {
		this.target = this.state = Math.max(0, Math.min(1, to));
	},
	Toggle : function() {
		this.seekTo(1 - this.target);
	},
	clearSubjects: function() {
		this.subjects = [];
	},
	OnTimerEvent: function() {
		var now = new Date().getTime();
		var timePassed = now - this.lastTime;
		this.lastTime = now;
		var movement = (timePassed / this.options.duration) * (this.state < this.target ? 1 : -1);
		if (Math.abs(movement) >= Math.abs(this.state - this.target)) {
			this.state = this.target;
		} else {
			this.state += movement;
		}
		try {
			this.propagate();
		} finally {
			this.options.onStep.call(this);
			if (this.target == this.state) {
				window.clearInterval(this.intervalId);
				this.intervalId = null;
				this.options.onComplete.call(this);
			}
		}
	},
	Play: function() {
		this.seekFromTo(0, 1)
	},
	Reverse: function() {
		this.seekFromTo(1, 0)
	}
}


// -------- END ANIMATION -----------


// EOF